import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const store = new Vuex.Store({
  state: {
    hasLogin: false, // 判断是否登录状态
    userInfo: {} // 用户信息
  },
  mutations: {
    login (state, provider) {
      state.hasLogin = true
      state.userInfo = provider
			localStorage.setItem('userInfo',JSON.stringify(provider))
    },
    logout (state) {
      state.hasLogin = false
      state.userInfo = {}
			localStorage.removeItem('userInfo')
    }
  },
  actions: {

  }
})

export default store
